<script>
var dopeisongliang='__URL__/dopeisongliang';
var dobeiliao='__URL__/dobeiliao';
var dojieshubeiliao='__URL__/dojieshubeiliao';
var dologinout='__APP__/Usr/dologinout';
var pid=0;
</script>
<!--table部分-->
<div class='col-md-12 col-xs-12'>
	<!--开始-->
	<table class='table table-hover table-striped table-bordered table-condensed' id='NBtb'>
		<thead>
			<tr style="background-color: #337ab7;color:#fff">
				<th>序号</th>
				<volist name='thls' id='thv'>
					<th>{$thv}</th>
				</volist>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
			<volist name='mls' id='mv'>
				<tr>
					<td>{$pagestart+$i}</td>
					<?php foreach ($mv as $key => $value) {
						if(!in_array($key,$hide_fld)){
					?>
						<td>{$value}</td>
					<?php 
						}
					} ?>
					
					<td>
					<a class='btn btn-success btn-sm' onclick="changepara({$mv['psid']},{$mv['parto']['partvolumeperpa']})" <?php if($lock||$mv['psodr']==99999999||$mv['f_ps_psstatid']==1){ ?>disabled<?php } ?> >完成</a>
					</td>
				</tr>
				<tr>
	              <td colspan=10>
                <div class='col-md-6 col-xs-6 nopadding'>
	              <?php
		            $wuliaojindu=$mv['psalready']/$mv['psvolume']*100;$wuliaojindu=round($wuliaojindu,1);
		            ?>
                <div class='col-md-4 col-xs-4 nopadding'>已送占比：{$wuliaojindu}%</div>
                <div class='col-md-8 col-xs-8 '>
	                <div class="progress" style="margin-bottom:0px">
	                  <div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="{$wuliaojindu}" aria-valuemin="0" aria-valuemax="100" style="width: {$wuliaojindu}%">
	                    <span class="sr-only">26% Complete (warning)</span>
	                  </div>
	                </div>
                </div>
                </div>
	                <?php
		            $shengchanjindu=$mv['plano']['planrealvolume']/$mv['plano']['planvolumebox']*100;$shengchanjindu=round($shengchanjindu,1);
		            ?>
                <div class='col-md-6 col-xs-6 nopadding'>
                <div class='col-md-4 col-xs-4 nopadding'>已生产占比：{$shengchanjindu}%</div>
                <div class='col-md-8 col-xs-8 '>
                <div class="progress" style="margin-bottom:0px">
	                  <div class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="{$shengchanjindu}" aria-valuemin="0" aria-valuemax="100" style="width: {$shengchanjindu}%">
	                    <span class="sr-only">23.4% Complete</span>
	                  </div>
	                </div>
                </div>
                </div>
	              </td>
	            </tr>
			</volist>
			
		</tbody>
	</table>
	
	<!--结束-->
	<?php
	//再次处理page
	$page=str_replace("<a", "<a class='btn btn-info'", $page);
	$page=str_replace('current', 'current btn btn-default', $page);
	?>
	
  <div class='col-md-2 col-xs-2'><a class='btn btn-primary' onclick="kaishibeiliao()" <?php if(!$lock){ ?>disabled<?php } ?> >开始备料</a></div>
  <div class='col-md-2 col-xs-2'><a class='btn btn-danger' onclick="jieshubeiliao()" <?php if($lock){ ?>disabled<?php } ?> >结束备料</a></div>
  <div class='col-md-2 col-xs-2'><a class='btn btn-success' href='__URL__/query/quanbu/1'>查看全部</a></div>
  <div class='col-md-2 col-xs-2'><a class='btn btn-warning' href='#' onclick="loginout()"><i class='glyphicon glyphicon-off'></i> 注销</a></div>
  <div class='col-md-4 col-xs-4'>{$page}</div>
</div>



<!--#################-->
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal_wancheng" style='display: none' id='wancheng'>
  Launch demo modal
</button>

<!-- Modal -->
<div class="modal" id="myModal_wancheng" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog" style='padding-top:100px'>
    <div class="modal-content">
      <div class="modal-header">
      <button type="button" class="close close_wancheng" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
      <h4 class="modal-title">缺省配送量</h4>
    </div>
      <div class="modal-body">
        <div class="input-group">
          <input type="telephone" class="form-control" id="defaultpeisongliang" placeholder="Amount" value="0">
          <div class="input-group-addon" onclick='jiajia()'><i class='glyphicon glyphicon-triangle-top'></i></div>
          <div class="input-group-addon" onclick='jianjian()'><i class='glyphicon glyphicon-triangle-bottom'></i></div>
        </div>
        
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-success" onclick='truejpeisongliang()'>确定</button>
        <button type="button" class="btn btn-default close_wancheng" data-dismiss="modal" >关闭</button>
        
      </div>
    </div>
  </div>
</div>

<script>
function changepara(psid,partvolumeperpa){
	pid=psid;
	$('#defaultpeisongliang').val(partvolumeperpa);
	clearInterval(int);
	$('#wancheng').trigger('click');
}



function truejpeisongliang(){
    var obj=new Object();
    obj['psid']=pid;
    if(!$.trim($('#defaultpeisongliang').val())){ msg('请输入正确的数量');$('.close_wancheng').trigger('click');return; }
    obj['defaultpeisongliang']=$.trim($('#defaultpeisongliang').val());
    $.ajax({
        'type': 'GET',
        'url':dopeisongliang,
        'async':false,  
        'contentType': 'application/json',
        'data': obj,
        'dataType': 'json',
        'success': function(data) {
            
            window.location.reload();
            
            console.log("success");
        },
        'error':function() {
            console.log("error");
        }
    });
}
function jiajia(){
    $('#defaultpeisongliang').val(parseInt($.trim($('#defaultpeisongliang').val()))+1);
}
function jianjian(){
    $('#defaultpeisongliang').val(parseInt($.trim($('#defaultpeisongliang').val()))-1);
}
</script>


<!--#################-->
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal_kaishibeiliao" style='display: none' id='kaishibeiliao'>
  Launch demo modal
</button>

<!-- Modal -->
<div class="modal" id="myModal_kaishibeiliao" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog" style='padding-top:100px'>
    <div class="modal-content">
      <div class="modal-header">
      <button type="button" class="close close_kaishibeiliao" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
      <h4 class="modal-title"></h4>
    </div>
      <div class="modal-body">
        <div class="input-group">
          <input type="telephone" class="form-control" id="beiliaoshuliang" placeholder="Amount" value="{$paramaxpapertm}">
          <div class="input-group-addon" onclick='jiajiajia()'><i class='glyphicon glyphicon-triangle-top'></i></div>
          <div class="input-group-addon" onclick='jianjianjian()'><i class='glyphicon glyphicon-triangle-bottom'></i></div>
        </div>
        
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-success" onclick='truekaishibeiliao()'>确定</button>
        <button type="button" class="btn btn-default close_kaishibeiliao" data-dismiss="modal" >关闭</button>
        
      </div>
    </div>
  </div>
</div>

<script>
function kaishibeiliao(){
	clearInterval(int);
	$('#kaishibeiliao').trigger('click');
}



function truekaishibeiliao(){
    var obj=new Object();
    if(!$.trim($('#beiliaoshuliang').val())){ msg('请输入正确的数量');$('.close_kaishibeiliao').trigger('click');return; }
    obj['beiliaoshuliang']=$.trim($('#beiliaoshuliang').val());
    $.ajax({
        'type': 'GET',
        'url':dobeiliao,
        'async':false,  
        'contentType': 'application/json',
        'data': obj,
        'dataType': 'json',
        'success': function(data) {
          var truelmt=data['truelmt'];
        	var url=window.location.href;
        	if(url.indexOf('lock')==-1){            
            	window.location.href=url+'/lock/'+truelmt;
            }else{
            	window.location.href=url.split('/lock/')[0]+'/lock/'+truelmt;
            }
            
            console.log("success");
        },
        'error':function() {
            console.log("error");
        }
    });
}
function jiajiajia(){
    $('#beiliaoshuliang').val(parseInt($.trim($('#beiliaoshuliang').val()))+1);
}
function jianjianjian(){
    $('#beiliaoshuliang').val(parseInt($.trim($('#beiliaoshuliang').val()))-1);
}
</script>

<script type="text/javascript">
var int=self.setInterval("window.location.reload()",60000);

$(function(){
    $('.close_wancheng').click(function(){
        var int=self.setInterval("window.location.reload()",60000);
    })
    $('.close_kaishibeiliao').click(function(){
        var int=self.setInterval("window.location.reload()",60000);
    })
})

function jieshubeiliao(){
    
    $.ajax({
        'type': 'GET',
        'url':dojieshubeiliao,
        'async':false,  
        'contentType': 'application/json',
        'data': {},
        'dataType': 'json',
        'success': function(data) {
          
          var url=window.location.href;
          if(url.indexOf('lock')!=-1){            
              
            window.location.href=url.split('/lock/')[0];
          }else{
            window.location.reload();
          }
          console.log("success");
        },
        'error':function() {
            console.log("error");
        }
    });
}

function loginout(){
  $.ajax({
      'type': 'GET',
      'url':dologinout,
      'async':false,  
      'contentType': 'application/json',
      'data': {},
      'dataType': 'json',
      'success': function(data) {
        
        window.location.reload();
      },
      'error':function() {
          console.log("error");
      }
  });
}

</script>

